<script>
//1、
function move({x=0,y=0}={}){
    return [x,y];
}
[{x=0,y=0}={}]=[];
move({x:3,y:8});//[3,8]
move({x:3});//[3,0]
move({});//[0,0]
move();   //[0,0]

//2、
// let [a, ,c, ,e]=[1,2,3,4,5]
// console.log(a,c,e);//1,3,5

// let [a,...args]=[10,2]
// console.log(args);//[2]

//3
// let d=0;
// function f(){
//     d=10;
//     return 11
// }
// let [a=1, ,b=3, c=f()]=[null,2,undefined,0]
// console.log(`a=${a},b=${b},c=${c},d=${d}`);//null,3,0,0

//4
const fn=()=>100
let options={
    size:{width:null},
    items:["蛋糕","甜甜圈","马卡龙"],
    extra:true
}
let {size:{width=fn(),height=10},item:[a, ,...b],extra,include=extra}=options
console.log(width,height,a,b,extra,include);
//100,10,蛋糕，['马卡龙'],true,true

//5
//const fn({1:a=1,length:b},...c)=>{console.log(a,b,c);}fn({})

// {1:a=1,length:b},...c}={}
// a=1,b=undefined,[]
// [{1:a=1,length:b},...c]=[[1,2,3,4],4]
[1,2,3,4][1]
arr =[1,2,3,4]
a = arr['1']
arr = {0:1, 1:2, 2:3 ,3: 4}

//a=2,3,[4]
//'y',3,['o','p','q']
let obj={name:'李四',age:18}
let obj2={name:'张三',...obj,age:19}
console.log(obj2);//name:'李四'，age:19

//6
//hello,undefined,[]
//null 你好 [undefined,2]

//7
//undefined,'test',[]
//{c:2}'test'[3] ==>{b='text'}={c:2}

// {x:x,...y}={y:2,x:1,z:3}
//x=1,y={y:2,z:3}

</script>